﻿using UnityEngine;
using System.Collections;
using DG.Tweening;
using UnityEngine.UI;

public class TestFade : MonoBehaviour
{

    public DOTween tweenColor;
    public Image image;

    private void Awake()
    {
        image.color = new Color(1, 1, 1, 0f);
    }
    // Use this for initialization
    void Start()
    {
        DOTween.Init();
        DOTween.Sequence().Append
        (
            DOTween.ToAlpha
            (
                () => image.color, (c) => image.color = c,
                1, 1.5f
            )
        ).
        Append
        (
            DOTween.ToAlpha
            (
                () => image.color, (c) => image.color = c,
                0, 1.5f
            )
         ).
         AppendCallback
         (
                TweenAlphaFinish
         );
    }

    public void TweenAlphaFinish()
    {
        Debug.Log("TweenAlpha Finished CallBack");
    }
}
